#ifndef MISCLIB_H_
#define MISCLIB_H_

#include <stdlib.h>

#define max(x,y) ((x) > (y) ? (x) : (y))

#define member_size(type, member) sizeof(((type *)0)->member)

#define IF_FREE(ptr) do { if (ptr) { free(ptr); (ptr) = NULL; } } while (0)

const char* basename(const char *name);
ssize_t writen(int fd, const void *vptr, size_t n);
void log_connect_info(int csock);
void log_listen_socket_info(int lsock);

#endif /* MISCLIB_H_ */
